package com.brayan.webapp.service.realestate;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import javax.ejb.Stateless;

import org.joda.time.LocalDate;

@Stateless
public class LocalDateShort {
	
	public LocalDateShort(){	
	}

	final String DATE_FORMAT = "yyyy-MM-dd";

	public LocalDateShort(LocalDate localDate) {

		DateFormat df = new SimpleDateFormat(DATE_FORMAT);
		id = df.format(localDate.toDate());

		if (localDate.compareTo(LocalDate.now()) == 0)
			isToday = true;
		else
			isToday = false;
		dayOfMonth = localDate.getDayOfMonth();
		monthOfYear = localDate.getMonthOfYear();
		year = localDate.getYear();
		dayOfWeek = localDate.getDayOfWeek();
		dayOfYear = localDate.getDayOfYear();
	}

	@Override
	public String toString() {
		return id;
	}

	public String id;
	public boolean isToday;
	public int dayOfMonth;
	public int monthOfYear;
	public int year;
	public int dayOfWeek;
	public int dayOfYear;
}